package com.dongyun.loraweb;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;

import com.dongyun.loraweb.dao.SystemAccountRepository;
import com.dongyun.loraweb.entity.SystemAccount;

public class StartupRunner implements ApplicationRunner {
	@Autowired
	private SystemAccountRepository systemAccountRepository;
	@Override
	public void run(ApplicationArguments args) throws Exception {
		System.out.println("==================初始化操作========================"+systemAccountRepository);
		SystemAccount s=systemAccountRepository.findByUserName("admin");
		if(s==null){
			s=new SystemAccount();
			s.setUserName("admin");
			s.setPassword("admin");
			systemAccountRepository.save(s);
		}
	}

}
